﻿@using Askmethat.Aspnet.JsonLocalizer.Localizer
@inject IDataService DataService
@inject IJsonStringLocalizer<ListModel> Localizer
@{
    AppSettings.SiteRoot = Url.Content("~/");
    var img = $"{AppSettings.SiteRoot}themes/philosophy/images";
    PostModel postModel = (PostModel)Model;
    string cover = $"{Url.Content("~/")}{postModel.Post.Cover}";
    var catUrl = Url.Content("~/categories");
    var cats = string.IsNullOrEmpty(postModel.Post.Categories)
        ? null : postModel.Post.Categories.Split(',').ToList();
}
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
    <!--- basic page needs
    ================================================== -->
    <meta charset="utf-8">
    <!-- mobile specific metas
    ================================================== -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!-- CSS
    ================================================== -->
    <link rel="stylesheet" href="~/themes/philosophy/css/base.css">
    <link rel="stylesheet" href="~/themes/philosophy/css/vendor.css">
    <link rel="stylesheet" href="~/themes/philosophy/css/main.css">
    <!-- script
    ================================================== -->
    <script src="~/themes/philosophy/js/modernizr.js"></script>
    <script src="~/themes/philosophy/js/pace.min.js"></script>
    <!-- favicons
    ================================================== -->
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link rel="icon" href="favicon.ico" type="image/x-icon">

    <partial name="~/Views/Shared/HeaderScript.cshtml" />
</head>

<body id="top">

    <!-- pageheader
    ================================================== -->
    <div class="s-pageheader">

        <partial name="~/Views/Themes/Philosophy/Shared/Header.cshtml" />

    </div> <!-- end s-pageheader -->
    <!-- s-content
    ================================================== -->
    <section class="s-content s-content--narrow s-content--no-padding-bottom">

        <article class="row format-standard">

            <div class="s-content__header col-full">
                <h1 class="s-content__header-title">
                    @postModel.Post.Title
                </h1>
                <ul class="s-content__header-meta">
                    <li class="date">@postModel.Post.Published.ToFriendlyDateString()</li>
                    @if (cats != null)
                    {
                        <li class="cat">
                            In
                            @foreach (var cat in cats)
                            {
                                <a href="~/categories/@cat">@cat</a>
                            }
                        </li>
                    }
                </ul>
            </div> <!-- end s-content__header -->

            <div class="s-content__media col-full">
                <div class="s-content__post-thumb">
                    <img src="@cover" alt="">
                </div>
            </div> <!-- end s-content__media -->

            <div class="col-full s-content__main">

                @Html.Raw(postModel.Post.Content)

                @if (cats != null)
                {
                    <p class="s-content__tags">
                        <span>@Localizer["tag", true]</span>

                        <span class="s-content__tag-list">
                            @foreach (var cat in cats)
                            {
                                <a href="~/categories/@cat">@cat</a>
                            }
                        </span>
                    </p> <!-- end s-content__tags -->
                }

                <div class="s-content__author">
                    <img src="~/@postModel.Post.Author.Avatar" alt="">

                    <div class="s-content__author-about">
                        <h4 class="s-content__author-name">
                            <a href="#">@postModel.Post.Author.DisplayName</a>
                        </h4>

                        <p>
                            @postModel.Post.Author.Bio
                        </p>

                        <ul class="s-content__author-social">
                            @foreach (var field in postModel.Post.SocialFields)
                            {
                            <li><a href="@field.Content">@field.Title</a></li>
                            }
                        </ul>
                    </div>
                </div>

                @if (postModel.Older != null || postModel.Newer != null)
                {
                    <div class="s-content__pagenav">
                        <div class="s-content__nav">
                            @if (postModel.Older != null)
                            {
                                <div class="s-content__prev">
                                    <a href="@postModel.Older.Slug" rel="prev">
                                        <span>@Localizer["previous"]</span>
                                        @postModel.Older.Title
                                    </a>
                                </div>
                            }
                            @if (postModel.Newer != null)
                            {
                                <div class="s-content__next">
                                    <a href="@postModel.Newer.Slug" rel="next">
                                        <span>@Localizer["next"]</span>
                                        @postModel.Newer.Title
                                    </a>
                                </div>
                            }
                        </div>
                    </div>
                }

            </div> <!-- end s-content__main -->

        </article>


        <!-- comments
        ================================================== -->
        <div class="comments-wrap">
            <div id="comments" class="row">
                <div class="col-full">
                    <div id="disqus_thread"></div>
                </div>
            </div>
        </div>

    </section> <!-- s-content -->

    <partial name="~/Views/Themes/Philosophy/Shared/Footer.cshtml" />
</body>
</html>